﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using MobiSms.ViewModel;
using System.Windows.Data;

namespace MobiSms.Wasun.Views
{
    public partial class SerialDetailsView : PhoneApplicationPage
    {
        SerialDetailsViewModel viewmodel;

        public SerialDetailsView()
        {
            InitializeComponent();

            viewmodel = (SerialDetailsViewModel)LayoutRoot.DataContext;

            this.Loaded += SerialDetailsView_Loaded;
        }

        void SerialDetailsView_Loaded(object sender, RoutedEventArgs e)
        {
            string guid = NavigationContext.QueryString["guid"];
            viewmodel.Guid = guid;
        }

        private void GotoDetailsView(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri(string.Format("/Views/MessageDetailsView.xaml?guid={0}", (sender as Button).Tag), UriKind.RelativeOrAbsolute));
        }

        private void OnTextBoxTextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox box = sender as TextBox;
            BindingExpression binding = box.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
        }
    }
}